package enterprise.web_jpa_war.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author <a href="mailto:Roman_Boiko@epam.com">Roman Boiko</a>
 */

@Entity   
@Table
public class DevicePropertyValue {
	@Id
        @GeneratedValue(strategy = GenerationType.TABLE)
	private Long id;
	
	@ManyToOne(cascade = CascadeType.PERSIST)
	private Device device;
	
	@ManyToOne(cascade = CascadeType.PERSIST)
	private DevicePropertyName propertyName;
	
	@Column(nullable=false)
	private String value;

	public DevicePropertyValue(){}
	
	public DevicePropertyValue(Device device, DevicePropertyName propertyName,
			String value) {
		super();
		this.device = device;
		this.propertyName = propertyName;
		this.value = value;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Device getDevice() {
		return device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	public DevicePropertyName getPropertyName() {
		return propertyName;
	}

	public void setPropertyName(DevicePropertyName propertyName) {
		this.propertyName = propertyName;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
}
